﻿//Various Brainfuck programs demonstrating capabilities of the language.
//Some of the examples were borrowed from Daniel B Cristofani's archive:
//http://www.hevanet.com/cristofd/brainfuck/. Feel free to add the rest.

namespace DimOS.Brainfuck
{
    public static class Examples
    {
        public const string HelloWorld = @"++++++++++[>+++++++>++++++++++>+++<<
        <-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.";

        public const string Fibonacci = @"+++++++++++++++++++++++++++++++++++++
        +++++++>++++++++++++++++++++++++++++++++>++++++++++++++++>>+<<[>>>>++++
        ++++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[<+>-]>[-]>>>++++++++++<[->-[
        >+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[+++++++++++++++++++++++++++++++++++++++
        +++++++++.[-]]<[++++++++++++++++++++++++++++++++++++++++++++++++.[-]]<<
        <++++++++++++++++++++++++++++++++++++++++++++++++.[-]<<<<<<<.>.>>[>>+<<
        -]>[>+<<+>-]>[<+>-]<<<-]<<++...";

        public const string Factorial = @"+++++++++++++++++++++++++++++++++>+++
        ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++>+
        ++++++>>+<<[>++++++++++++++++++++++++++++++++++++++++++++++++.---------
        ---------------------------------------<<<<.-.>.<.+>>>>>>>++++++++++<<[
        ->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[<+>-]>[-]>>>++++++++++<[->-[>+>>]>[+[
        -<+>]>+>>]<<<<<]>[-]>>[++++++++++++++++++++++++++++++++++++++++++++++++
        .[-]]<[++++++++++++++++++++++++++++++++++++++++++++++++.[-]]<<<++++++++
        ++++++++++++++++++++++++++++++++++++++++.[-]<<<<<<.>>+>[>>+<<-]>>[<<<[>
        +>+<<-]>>[<<+>>-]>-]<<<<-]";

        public const string InfiniteFibonacci = @">++++++++++>+>+[[+++++[>+++++
        +++<-]>.<++++++[>--------<-]+<<<]>.>>[[-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[
        >+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>>]<<<]";

        public const string InfiniteFactorial = @">++++++++++>>>+>+[>>>+[-[<<<<
        <[+<<<<<]>>[[-]>[<<+>+>-]<[>+<-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+
        <-[>+<-[>[-]>>>>+>+<<<<<<-[>+<-]]]]]]]]]]]>[<+>-]+>>>>>]<<<<<[<<<<<]>>>
        >>>>[>>>>>]++[-<<<<<]>>>>>>-]+>>>>>]<[>++<-]<<<<[<[>+<-]<<<<]>>[->[-]++
        ++++[<++++++++>-]>>>>]<<<<<[<[>+>+<<-]>.<<<<<]>.>>>>]";

        public const string InfiniteEcho = @",[.,]";

        public const string InfiniteSquares = @">>>>>>>>>>+>++<[[[<<+>+>-]+++++
        +[<++++++++>-]<-.[-]<<<]++++++++++.[-]>>>>>[>>>>]<<<<[[<<<+>+>>-]<<<-<]
        >>++[[<<<++++++++++[>>>[->>+<]>[<]<<<<-]>>>[>>[-]>>+<<<<[>>+<<-]]>>>>]<
        <-[+>>>>]+[<<<<]>]>>>[>>>>]<<<<-<<+<<]";
    }
}
